﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for BaseMasterPage
/// </summary>
public class BaseMasterPage : System.Web.UI.MasterPage
{
    public PageConfig.Pages CurrentPage { get; set; }

    protected override void OnPreRender(EventArgs e)
    {
        PageConfig page = UserAccess.PageConfig.SingleOrDefault(p => p.PageId == Convert.ToInt32(this.CurrentPage));
        if (page != null && !string.IsNullOrEmpty(page.PageTitle))
            this.Page.Title = page.PageTitle;

        base.OnPreRender(e);
    }

    public bool AuthorizeCurrentUser()
    {
        return UserAccess.AuthorizeCurrentUser(this.CurrentPage);
    }
}
